How to divided a measure with a different measure from another cube by treating it as a constant static value

Hi, I have to convert this sql query to something which the cube can run, select count(word)/ (select count(book_id) from table A) from table B group by title.

table A is like book_id,word and each word is written once per book_id, but a book can have multiple words
table B also has book_id
cube A and cube B have been joined on book_id, for some other purposes.
Basically, I want to get the percentage of times any word has occurred over a group of books. Using subquery by referencing measure of table B and creating a dimension, then using that dimension and calculating new measure seems to give an error as the dimension value is not an aggregate.

Since a single SQL query is possible wanted to know if its possible to convert it into a single cube query.

Hi @dmg ,
It’s hard to say for sure without access to you schema but I would say that you definitely should be able to define needed in the sql property of your cube